from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from pirateissues.models import Issue
    
#Stance is a type of argument -- probably specified by admin
class Stance(models.Model):
    arg = models.CharField(max_length=20)
    
    def __unicode__(self):
        return self.arg
    
# An argument of {arg_type} that is attached to an Issue 
#This should be a pirate-wikipage instance
class Argument(models.Model):
    name = models.CharField(max_length=140)
    pub_date = models.DateTimeField('date_published')
    parent = models.ForeignKey(Issue) #Issue
    author = models.ForeignKey(User, related_name='arg_author')
    text = models.CharField(max_length=1000)
    arg_type = models.ForeignKey(Stance)
    #comments = generic.GenericRelation(Comment)
    
    def __unicode__(self):
        return self.name
    
admin.site.register(Stance)
admin.site.register(Argument) 
